package com.bnz.portal.controller;

import com.bnz.portal.entity.ContentEntity;
import com.bnz.portal.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xy
 * @date 2022/11/9
 */
@Controller
public class ContentController {
    @Autowired
    ContentService contentService;

    @GetMapping({"/","/index.html"})
    public String index(Model model){


        List<ContentEntity> contentEntities = contentService.findByCategoryId2("1");  // 参数代表分类的id
        System.out.println(contentEntities);
        model.addAttribute("contentList",contentEntities);
        return "index";
    }
}
